<?php

include "global.php"; // Get Configuration
getsettings();

error_reporting(5);
####### Checking the website Status ############ //
if ($website_active != '1') {
eval("dooutput(\"".gettemplate("closed_page")."\");");
exit;
}

if ($_GET["code"] != "")
{
  $code = $_GET["code"];
  $member_type = $_GET["type"];
  list($id) = $DB_site->query_first("SELECT id FROM $member_type WHERE activation_code='$code' AND account_status='Unconfirmed'");
  if ($id != "")
  {
    $result = $DB_site->query("UPDATE $member_type SET account_status='Active' WHERE id='$id'");
    $msg = "Activation successful.";
    if ($type == "teachers") $goto_link = $website_teachers;
    else if ($type == "volunteers") $goto_link = $website_volunteers;
    else $goto_link = $website_home;
    
?>
<html>
<head>
<title>Activation Successful...</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh" CONTENT="1; URL=<?php echo $goto_link?>">
</head>

<body bgcolor="#FFFFFF">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <div align="center"><font face="Arial, Helvetica, sans-serif" size="3"><b><?php echo $msg?></b></font></div>
    </td>
  </tr>
  <tr>
    <td>
      <div align="center"><font face="Arial, Helvetica, sans-serif" size="1">Taking to Login Page..Loading..Please 
        wait .. <a href="<?php echo $goto_link?>">Click here</a> if nothing happens</font></div>
    </td>
  </tr>
</table>
</body>
</html>
<?php
		exit;
    
  }
  else
    $msg = "Activation Failed. Please contact Support.";
}
echo $msg;

?>
